package org.springframework.designPattern.singletonPattern;



public class SingletonPatternTest {
	public static void main(String[] args) {
		// 静态属性实现恶汉式单例模式
		System.out.println(org.springframework.designPattern.singletonPattern.impla.ToolBox.getInstance());
		System.out.println(org.springframework.designPattern.singletonPattern.impla.ToolBox.getInstance());
		// 双重检查实现懒汉式单例模式
		System.out.println(org.springframework.designPattern.singletonPattern.implb.ToolBox.getInstanceSync());
		System.out.println(org.springframework.designPattern.singletonPattern.implb.ToolBox.getInstance());
		// 静态内部类实现饿汉式单例模式
		System.out.println(org.springframework.designPattern.singletonPattern.implc.ToolBox.getInstance());
		System.out.println(org.springframework.designPattern.singletonPattern.implc.ToolBox.getInstance());
	}
}
